{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. numpy图像数组的显示问题"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "from torch import nn\n",
    "import numpy as np\n",
    "import torch.nn.functional as F\n",
    "import matplotlib.pyplot as plt\n",
    "from torch import nn, optim\n",
    "from torch.autograd import Variable"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(28, 28, 3)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x1922fb809b0>"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAHMhJREFUeJztnXt8zvX7x1+XU47NcXPYHGIOOUUjKtK3hKx0UNEBJVbx/SIdpJJD9RVCBynkVArfHCuhqExJRjGHhRjGcj6GHPb+/eH2e+xXrmtr5r73/b1fz8fDw7bnrvt+795eu7ddn/f7EuccCCH+kSvUCyCEhAaGnxBPYfgJ8RSGnxBPYfgJ8RSGnxBPYfgJ8RSGnxBPYfgJ8ZQ8wbyz4rkLuag8RVV/MjLNrE85cVp1l/9R2qwNSzti+tTLfjd9iTN5VZcnV4RZm1Is1fSFT+m3DQBI3mPqsLIVVFekwFazdsvpAqa/onhF06ee3mT6E/v0+gIH95q1JwucMH3e/PrHDQAlcx9SnStRyKyV3Mmmz7Ml3PRnwg+a/o+t+v1fVqKwfdsl9c/Z7l2/4fDBQ2LeQICLCr+ItATwBoDcAMY55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CYtRGvrLyI7A4/dzyJya4jWFiUiX4vIBhFZJyI9Am8P6WNnrCskj1vQf+wXkdwANgJoDiAFwAoA7Z1z9gbqICEiyQBinHMh7wmLSFMAxwBMds7VCrxtCIADzrnBgW+cxZxzz+aQtfUHcCzUk5sDA2XKpJ8sDeAOAJ0QwsfOWNe9CMHjFopn/oYANjvntjjnTgGYCqBNCNaR43HOLQHw51NI2gCYFHh5Es598QQdZW05AudcqnNuVeDlowDOT5YO6WNnrCskhCL85QDsSPd6CnLWyG8HYKGIrBSRrqFezAWIOD8ZKfB/eIjX82cynNwcTP40WTrHPHZZmXid3YQi/Bea/pOTWg7XOefqA2gFoFvgx1uSOTI1uTlYXGCydI4gqxOvs5tQhD8FQFS61yMB7ArBOi6Ic25X4P89AGYh500f3n1+SGrg/z0hXs//kpMmN19osjRywGOXkyZehyL8KwBEi0glEckHoB2AuSFYx18QkUKBP8RARAoBuAU5b/rwXAAdAy93BKCfkBlkcsrkZm2yNEL82OW0idchucgn0MoYCSA3gPHOuVeCvogLICJX4NyzPXDuZOOPQrk2EfkYQDOc2/W1G8BLAGYDmA6gPIDtAO5xzgX9D2/K2prhb05uvkRr0yZLL0cIH7vsnHidLevhFX6E+Amv8CPEUxh+QjyF4SfEUxh+QjyF4SfEUxh+QjyF4SfEUxh+QjzlfwCE5025kPyQegAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1922fa2d860>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "img = np.random.rand(28,28,3)\n",
    "img = (img - img.min()) / (img.max()-img.min())   # 将原始缩放到 [0,1]\n",
    "# print(img)\n",
    "print(img.shape)\n",
    "plt.imshow(img,cmap='gray')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(28, 28)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<matplotlib.image.AxesImage at 0x19230ec2160>"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAGYJJREFUeJzt3Xlw1tW5B/DvIxAIqyxhX0VQKJZlIqggIlZwrUJri7bK7YYyrb2OOtNKraijrTout+gdO1Q2AWkZULGWunJRwCtlEYUKyC5LCCBKQFECPPcPXntT5XxPTML7xjnfzwxDkm9O3pM375M3yfmd85i7Q0TSc1KuJyAiuaHiF0mUil8kUSp+kUSp+EUSpeIXSZSKXyRRKn6RRKn4RRJVM5s31rBhQ2/evHkw37dvHx1ft27dYFajRg06tlatWjQvKSmheWlpaTBr0KABHVu7dm2a7927l+YFBQU0P3r0aDD78MMP6diPP/6Y5vn5+TQ3M5rXqVMnmH3wwQd0bOfOnWkeuzp1x44dwezgwYN0bMOGDWkeezyxzxvgj6dPP/2UjmV1cujQIRw+fJh/UTIqVfxmdhGAPwCoAeAJd7+PvX/z5s3x4IMPBvMXXniB3l7v3r2DWeyLxb7pAMCrr75K8507dwazQYMG0bEdO3ak+cyZM2l+ww030Jw9kGfNmkXHLl68mObdunWjeeybQ9euXYPZ1KlT6dinn36a5qyAAOCOO+4IZm+//TYdO3ToUJq3bt2a5qeddhrNt2/fHszWrl1Lx86dOzeYrVu3jo4tq8I/9ptZDQD/DeBiAN0BXG1m3Sv68UQkuyrzO39fAOvdfaO7HwLwZwBXVM20ROREq0zxtwGwtczr2zJv+zdmNsrMlprZ0tjv1SKSPZUp/uP9UeFLf4Fx9/HuXujuhbHfy0UkeypT/NsAtCvzelsA4T+viki1UpniXwKgi5l1MrM8ACMAPFc10xKRE63CS33uftjMfgHgRRxb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RdencHOosjRzfd9Wt43VOLvLJLGX8F4AaACa6+71Zn8RxmNkpOPZsDxw72fipXM7NzGYAGIRju76KAYwF8CyAmQDaA3gfwFXunvU/vAXmNgjHfnT9V+fmz3/HzvLcBgBYAGAlgKOZN4/Bsd+vc3bfkXldjRzcb7rCTyRRusJPJFEqfpFEqfhFEqXiF0mUil8kUSp+kUSp+EUSpeIXSdT/AZ9TQOEk5uPWAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1922fa2d5f8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "img = np.random.randn(28,28)\n",
    "img = (img - img.min()) / (img.max()-img.min())   # 将原始缩放到 [0,1]\n",
    "# print(img)\n",
    "print(img.shape)\n",
    "plt.imshow(img,cmap='gray')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**总结：**\n",
    "1. 待显示图像的范围一定要在[0,1]内\n",
    "2. 显示3通道的图像，即使设置`cmap='gray'`，仍然会显示彩色图像\n",
    "3. 显示灰度图像，只能使用二维的数据，即(H,W)，如果使用三维数据(H,W,1)会报错"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2. BCELoss函数测试"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2.168816089630127 2.168816089630127\n"
     ]
    }
   ],
   "source": [
    "x = torch.randn(5,4)         # 注意标准正态分布，是 N(0,1)，但根据3sigma原则，范围大致在(-3,3)内\n",
    "y = torch.randn(5,4)\n",
    "scale = lambda x: (x-x.min())/(x.max()-x.min())\n",
    "x, y = map(scale, [x,y])\n",
    "# print(x.max(), y.min())\n",
    "loss = nn.BCELoss()(x, y)       # 只要数据和标签在[0,1]内，就可以使用该函数\n",
    "loss2 = F.binary_cross_entropy(x,y)\n",
    "print(loss.data.item(), loss2.data.item())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.62582359  0.91633515 -0.37896039 -0.88107122]\n",
      " [ 0.56850879  0.23657873 -2.09796478 -0.03831756]\n",
      " [ 0.10432753  0.18737557  2.03714176 -0.63758098]]\n",
      "\n",
      "[ 0.56850879  0.91633515  2.03714176 -0.03831756]\n",
      "\n",
      "[[-1.19433237  0.         -2.41610215 -0.84275366]\n",
      " [ 0.         -0.67975643 -4.13510654  0.        ]\n",
      " [-0.46418126 -0.72895958  0.         -0.59926342]]\n"
     ]
    }
   ],
   "source": [
    "x = np.random.randn(3,4)\n",
    "print(x)\n",
    "print()\n",
    "print(np.max(x, 0))\n",
    "print()\n",
    "print(x -np.max(x, 0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', 'irange', 'make_grid', 'math', 'save_image', 'torch']\n"
     ]
    }
   ],
   "source": [
    "import torchvision.utils as t\n",
    "print(dir(t))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 损失函数的公式：\n",
    "\n",
    "nn.BCELoss"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$\\ell(x, y) = L = \\{l_1,\\dots,l_N\\}^\\top, \\quad\n",
    "    l_n = - w_n \\left[ y_n \\cdot \\log x_n + (1 - y_n) \\cdot \\log (1 - x_n) \\right]$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "nn.CrossEntropyLoss"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$\\text{loss}(x, class) = -\\log\\left(\\frac{\\exp(x[class])}{\\sum_j \\exp(x[j])}\\right)\n",
    "                   = -x[class] + \\log\\left(\\sum_j \\exp(x[j])\\right)$$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. unsqueeze函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "torch.Size([4])\n",
      "torch.Size([4, 1])\n",
      "torch.Size([1, 4])\n"
     ]
    }
   ],
   "source": [
    "a = torch.tensor([1,5,3,4])\n",
    "print(a.shape)\n",
    "b = a.unsqueeze(1)\n",
    "print(b.shape)\n",
    "c = a.unsqueeze(0)\n",
    "print(c.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 5, 3, 4], dtype=int64)"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a.numpy()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([1, 3, 4, 5])"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a[a.numpy().argsort()]           # 排序"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4. plot只能按照x自身元素的的顺序画图，无法区别大小"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "np.random.seed(7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[<matplotlib.lines.Line2D at 0x19230f5bb00>]"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD8CAYAAAB+UHOxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl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JIUEgCCIIgkhQSAIAgiSSEBIAiCSFL+H1I5XnBYIItKAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1922fa25e10>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "x = np.random.randn(10)\n",
    "y = np.random.randn(10)\n",
    "plt.subplot(121)\n",
    "plt.plot(x,y)                # 无序的数据画图的结果，尤其是画连续的曲线时需注意!!!\n",
    "plt.subplot(122)\n",
    "x = x[x.argsort()]           # 对x进行排序可以画出按顺序的直线\n",
    "plt.plot(x,y)                # 排序的数据画的结果"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5. filter过滤函数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[1, 2, 6]]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list(filter(lambda x: x[-1]==6, [[1,2,0],[1,2,3],[1,2,6],[1,2,0]]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "100内的素数:\n",
      "2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 "
     ]
    }
   ],
   "source": [
    "# 1.打印素数,除2的偶数都不是素数，所以从大于3的奇数中选就行\n",
    "# 这些高阶函数只需转入函数名就行，传入的参数一般只有一个\n",
    "def _odd_iter():   # 产生奇数的惰性序列，无穷的\n",
    "    n = 1\n",
    "    while True:\n",
    "        n += 2\n",
    "        yield n\n",
    "        \n",
    "def _not_divisible2(n):\n",
    "    return lambda x: x % n > 0\n",
    "#     return lambda x: True\n",
    "\n",
    "def primes():\n",
    "    yield 2\n",
    "    it = _odd_iter() # 初始序列\n",
    "    while True:\n",
    "        n = next(it) # 返回序列的第一个数\n",
    "        yield n\n",
    "        it = filter(_not_divisible2(n), it) # 构造新序列，注意这里使用函数调用，但返回值是函数\n",
    "        \n",
    "# 打印100以内的素数:\n",
    "print('100内的素数:')\n",
    "for n in primes():\n",
    "    if n < 100:\n",
    "        print(n, end=' ')\n",
    "    else:\n",
    "        break"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 6. shuffle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[1, 2, 3],\n",
       "       [1, 2, 3],\n",
       "       [4, 5, 6]])"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import random\n",
    "a = np.array([[1,2,3],[4,5,6],[7,8,9]])\n",
    "random.shuffle(a)          # 作用于多维数组会出现重复的行\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([2, 3, 9, 0, 7, 6, 1, 4, 8, 5])"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import random\n",
    "a = np.arange(10)\n",
    "random.shuffle(a)          # 作用于一维数组不会出现重复\n",
    "a"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 7.IntTensor中的整除符号 '/'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([0, 0, 1], dtype=torch.int32)\n",
      "tensor([0.3333, 0.6667, 1.0000])\n"
     ]
    }
   ],
   "source": [
    "a = torch.IntTensor([1,2,3])\n",
    "a\n",
    "print(a / 3)                  # PyTorch中的整型tensor使用整除\n",
    "print(a.float() / 3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.8\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "print(4 / 5)                # python中 '/'表示普通的除法\n",
    "print(3 // 5)               # python中 '//'表示整除    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "   "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
